package chai.ningning.dev;

import java.io.IOException;
import java.io.PrintWriter;
import java.time.LocalDateTime;

import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class PrimitiveServlet implements Servlet{

	private ServletConfig config;

	@Override
	public void init(ServletConfig config) throws ServletException {
		this.config = config;
	}

	@Override
	public void service(ServletRequest req, ServletResponse resp) throws ServletException, IOException {
		
		
		
		PrintWriter out = resp.getWriter();
		
		out.println("<div>");
		out.println(LocalDateTime.now());
		out.println("</div>");
	
		out.println("<div>");
		out.println(this);
		out.println("</div>");
		
		out.println("<div>");
		out.println(Thread.currentThread());
		out.println("</div>");
		
		out.println("<div>");
		out.println(this.getClass().getClassLoader());
		out.println("</div>");
	}

	@Override
	public void destroy() {
		
	}

	@Override
	public ServletConfig getServletConfig() {
		return config;
	}

	@Override
	public String getServletInfo() {
		return " ";
	}
}
